package com.stadium.web.repository;

import com.stadium.web.domain.Region;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
/**
 * 区域信息Repository接口
 * 
 * @author ruoyi
 * @date 2020-03-15
 */
public interface RegionRepository extends JpaRepository<Region, Long>
{

    /**
     * 查询区域信息
     *
     * @param id 区域信息ID
     * @return 区域信息
     */
//    public Region findByIdAndStatus(Long id, Byte status);


    @Modifying
    @Transactional
    @Query("update #{#entityName} set status = ?1  where id in ?2")
    Integer updateStatusByIdIn(Byte code, List<Long> ids);

    @Query("select count(name) from #{#entityName} where id <> :id and name =:name")
    Integer exitName(@Param("name") String name,@Param("id") Long id);
}
